// Register replace_smiley
BloggerExt.replace_smiley = function() {

    jQuery('div.blog-posts').find('.post-body, .comment-body, .comment-body-author').each( function (i) {
            var newHtml = jQuery(this).html();
            for( var idx in BloggerExtOptions.smilies ) {
                newHtml = newHtml.replace(BloggerExtOptions.smilies[idx][0], BloggerExtOptions.smilies[idx][1], "gm");
            }
            // fixed to no replace, if content is the same. and not eval script
            if(jQuery(this).html().length != newHtml.length) jQuery(this).attr("innerHTML", newHtml );

    });

};
BloggerExt.register('replace_smiley' ,  {
    replace_smiley: true,

    smilies: [
                [' :)', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/1.gif" style="border:0; margin:0; padding:0;" /> '],
                [' :(', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/2.gif" style="border:0; margin:0; padding:0;" /> '],
                [' ;)', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/3.gif" style="border:0; margin:0; padding:0;" /> '],
                [' :D', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/4.gif" style="border:0; margin:0; padding:0;" /> '],
                [' :p', '<img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/10.gif" style="border:0; margin:0; padding:0;" /> '],
                [' :$', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/32.gif" style="border:0; margin:0; padding:0;" /> '],
                [' :-k', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/11.gif" style="border:0; margin:0; padding:0;" /> '],
                [' :*', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/11.gif" style="border:0; margin:0; padding:0;" /> '],
                [' :@', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/14.gif" style="border:0; margin:0; padding:0;" /> '],
                [' :#', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/33.gif" style="border:0; margin:0; padding:0;" /> '],
                [' [-(', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/33.gif" style="border:0; margin:0; padding:0;" /> '],
                [' :x', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/35.gif" style="border:0; margin:0; padding:0;" /> '],
                [' :o', ' <img src="http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/13.gif" style="border:0; margin:0; padding:0;" /> ']
             ]
});
BloggerExt.registerHook(BloggerExt.replace_smiley);

